$(function() {
    var a = 300, b = 300;
    $(".stack>img").toggle(function() {
        var b = 0, c = 0, d = $(this);
        d.next().children().each(function() {
            $(this).animate({
                top: "-" + b + "px",
                left: c + "px"
            }, a), b += 55, c = 2 * (c + .75);
        }), d.next().animate({
            top: "-50px",
            left: "10px"
        }, a).addClass("openStack").find("li a>img").animate({
            width: "50px",
            marginLeft: "9px"
        }, a), d.animate({
            paddingTop: "0"
        });
    }, function() {
        var a = $(this);
        a.next().removeClass("openStack").children("li").animate({
            top: "55px",
            left: "-10px"
        }, b), a.next().find("li a>img").animate({
            width: "79px",
            marginLeft: "0"
        }, b), a.animate({
            paddingTop: "35px"
        });
    }), $(".stack li a").hover(function() {
        $("img", this).animate({
            width: "56px"
        }, 100), $("span", this).animate({
            marginRight: "30px"
        });
    }, function() {
        $("img", this).animate({
            width: "50px"
        }, 100), $("span", this).animate({
            marginRight: "0"
        });
    });
});